<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <title>登录</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link href="css/login.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>

</head>

<body class="signin">
    <div class="signinpanel">
        <div class="row">
            <div class="col-sm-7">

            </div>
            <div class="col-sm-5">
                <form>
                    <h4 class="no-margins">登录：</h4>
                    <p class="m-t-md"><span>刘万</span>&nbsp;的博客管理系统</p>
                    <input type="text" class="form-control uname" placeholder="用户名" />
                    <input type="password" class="form-control pword m-b" placeholder="密码" />
                    <a href="">忘记密码了？</a>
                    <button class="btn btn-success btn-block">登录</button>
                </form>
            </div>
        </div>
        <div class="signup-footer">
            <div class="pull-left">
                &copy; 刘万的博客--2018
            </div>
        </div>
    </div>
</body>

</html>
<script src="js/jquery.js"></script>
<script>
    $(function () {
        $(".btn").on("click",function () {
            $.ajax({
                type: "POST",
                url: "http://localhost:5656/login",
                data: {
                    username: $(".uname").val(),
                    password: $(".pword").val()
                }
            }).then(function (res) {
                console.log(res[0].u_id);
                if(res[0].u_id){
                    alert("登录成功");
                    window.location.assign("admin.html");
                }else {
                    alert("账号或密码错误");
                }
            })
            return false
        })

    })
</script>
